library(mapview)
library(tidyr)
library(sf)
library(dplyr)
library(readr)
library(leaflet)
sessionInfo()
## R version 4.2.1 (2022-06-23 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19042)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.utf8
## [2] LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] leaflet_2.1.1 readr_2.1.3 dplyr_1.0.7 sf_1.0-8 tidyr_1.2.1
## [6] mapview_2.11.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.9 lattice_0.20-45 png_0.1-7 class_7.3-20
## [5] assertthat_0.2.1 digest_0.6.27 utf8_1.2.2 R6_2.5.1
## [9] stats4_4.2.1 evaluate_0.17 e1071_1.7-4 pillar_1.8.1
## [13] rlang_1.0.6 rstudioapi_0.13 raster_3.5-29 jquerylib_0.1.4
## [17] rmarkdown_2.14 webshot_0.5.2 stringr_1.4.1 htmlwidgets_1.5.4
## [21] munsell_0.5.0 compiler_4.2.1 xfun_0.34 pkgconfig_2.0.3
## [25] base64enc_0.1-3 htmltools_0.5.3 tidyselect_1.2.0 tibble_3.1.8
## [29] codetools_0.2-18 fansi_1.0.3 tzdb_0.1.2 grid_4.2.1
## [33] jsonlite_1.8.4 satellite_1.0.2 lifecycle_1.0.3 DBI_1.1.3
## [37] magrittr_2.0.3 units_0.8-0 scales_1.2.1 KernSmooth_2.23-20
## [41] cli_3.4.1 stringi_1.7.8 sp_1.5-0 bslib_0.3.1
## [45] ellipsis_0.3.2 generics_0.1.2 vctrs_0.5.0 tools_4.2.1
## [49] leafem_0.1.3 glue_1.6.2 purrr_1.0.1 hms_1.1.2
## [53] crosstalk_1.2.0 fastmap_1.1.0 yaml_2.2.1 colorspace_2.0-3
## [57] terra_1.6-17 classInt_0.4-3 knitr_1.40 sass_0.4.1
Background WMS showing both NHDPlus Medium Res flowlines and NHDPlus HR flowlines
points <- tribble(~name, ~lat, ~lon,
'Point A',44.564568,-123.262047, )
points_sf <- st_as_sf(points, coords = c("lon", "lat"), crs = 4269)
m <- mapview(points_sf, legend=FALSE)
m@map <- m@map %>% addWMSTiles(group = 'USGS HydroCache',
"https://basemap.nationalmap.gov:443/arcgis/services/USGSHydroCached/MapServer/WmsServer?",
layers = 0,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "")%>%
setView(-123.26, 44.56, zoom = 14)
m
m@map <- m@map %>% addWMSTiles(group = 'NHDPlus',
"https://watersgeo.epa.gov/arcgis/services/NHDPlus_NP21/NHDSnapshot_NP21/MapServer/WmsServer?",
layers = 4,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "") %>% addWMSTiles(group = 'NHDPlusHR',
"https://hydro.nationalmap.gov/arcgis/services/NHDPlus_HR/MapServer/WMSServer?",
layers = 9,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "") %>% mapview:::mapViewLayersControl(names = c("NHDPlus","NHDPlusHR")) %>%
setView(-123.26, 44.56, zoom = 14)
m
Wetland 2011 sites from NARS data page and FWS wetlands map service
wetlands <- read_csv('https://www.epa.gov/sites/production/files/2016-10/nwca2011_siteinfo.csv')
wetlands <- st_as_sf(wetlands, coords = c("AA_CENTER_LON", "AA_CENTER_LAT"), crs = 4269)
m <- mapview(wetlands, legend=FALSE)
m@map <- m@map %>% addWMSTiles(group = 'NWI',
"https://fwspublicservices.wim.usgs.gov/server/services/Wetlands/MapServer/WmsServer?",
layers = 1,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "")%>% mapview:::mapViewLayersControl(names = c("NWI"))
m
River and Stream 13-14 sites from NARS data page and NHDPLus / NHDPlusHR service
sites <- read_csv('https://www.epa.gov/sites/production/files/2019-04/nrsa1314_siteinformation_wide_04292019.csv')
sites <- sites %>%
select(SITE_ID,LON_DD83,LAT_DD83)
sites <- st_as_sf(sites, coords = c("LON_DD83", "LAT_DD83"), crs = 4269)
m <- mapview(sites, legend=FALSE)
m@map <- m@map %>% addWMSTiles(group = 'NHDPlus',
"https://watersgeo.epa.gov/arcgis/services/NHDPlus_NP21/NHDSnapshot_NP21/MapServer/WmsServer?",
layers = 4,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "") %>% addWMSTiles(group = 'NHDPlusHR',
"https://hydro.nationalmap.gov/arcgis/services/NHDPlus_HR/MapServer/WMSServer?",
layers = 9,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "") %>% mapview:::mapViewLayersControl(names = c("NHDPlus","NHDPlusHR"))
m
Lakes sites from NARS data page and NHDPLus / NHDPlusHR service
lakes <- read_csv('https://www.epa.gov/sites/production/files/2016-12/nla2012_wide_siteinfo_08232016.csv')
lakes <- lakes %>%
select(SITE_ID,LON_DD83,LAT_DD83)
lakes <- st_as_sf(lakes, coords = c("LON_DD83", "LAT_DD83"), crs = 4269)
m <- mapview(lakes, legend=FALSE)
m@map <- m@map %>% addWMSTiles(group = 'NHDPlus',
"https://watersgeo.epa.gov/arcgis/services/NHDPlus_NP21/NHDSnapshot_NP21/MapServer/WmsServer?",
layers = 3,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "") %>% addWMSTiles(group = 'NHDPlusHR',
"https://hydro.nationalmap.gov/arcgis/services/NHDPlus_HR/MapServer/WMSServer?",
layers = 2,
options = WMSTileOptions(format = "image/png", transparent = TRUE),
attribution = "") %>% mapview:::mapViewLayersControl(names = c("NHDPlus","NHDPlusHR"))
m